﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Mark_dal
{
    public class Adminlogin_dal
    {
        public bool UserLogin(string name, string pass)
        {
            DBHelper db = new DBHelper();
            string sql = string.Format(@"select * 
from AdminInfo where AdmiNname='{0}' and AdminPass = '{1}'", name, pass);
            

            SqlDataReader dr = db.GetAll(sql);      
            bool hasData = dr.Read();
            dr.Close();
            db.Close();
            return hasData;
        }
        public int shenfen(string name, string pass)
        {
            DBHelper db = new DBHelper();
            string sql = string.Format(@"select AdminRole
from AdminInfo where AdmiNname='{0}' and AdminPass = '{1}'", name, pass);
           object a= db.GetOne(sql);
           
          
          
            db.Close();

            return Convert.ToInt32(a);
        }
    }
}
